import {
  APPROVAL_STATUS_SELECT_LIST,
} from '@/pages/supplier/constants/common'
import { getInitialFieldsValue, list2Obj } from '@/pages/supplier/utils';
// 供应商管理 - 来访记录待审批列表
const FORM_ITEM_LIST = [
  { prop: 'supplierCode', label: '供应商代码', type: 'input', },
  { prop: 'supplierName', label: '供应商名称', type: 'input', },
  { prop: 'belongDepartment', label: '采购归属', type: 'belongCenter', },
  { prop: 'managementAreaId', label: '管理区域', type: 'managementArea', },
  { prop: 'status', label: '单据状态', type: 'select', clearable: true, options: APPROVAL_STATUS_SELECT_LIST, },
  { prop: 'createUser', label: '发起人', type: 'input', },
  { prop: 'createTime', label: '发起时间', type: 'datePicker', },
]
const INITIAL_FIELDS_VALUE = getInitialFieldsValue(FORM_ITEM_LIST)
const APPROVAL_STATUS_MAP_OBJECT = list2Obj(APPROVAL_STATUS_SELECT_LIST)
const TABLE_COLUMNS = [
  { title: '序号', key: 'index', width: 50 },
  { title: '供应商代码', key: 'supplierCode', },
  { title: '供应商名称', key: 'supplierName', },
  { title: '供应商采购归属', key: 'belongDepartmentName' },
  { title: '供应商管理区域', key: 'belongAreaName', },
  { title: '发起人', key: 'createUser', width: 80, },
  { title: '发起时间', key: 'createTime', width: 160, },
  { title: '单据状态',
    key: 'status',
    formatter: (row, columns, cellValue) => {
      return APPROVAL_STATUS_MAP_OBJECT[cellValue]
    },
  },
]
export {
  INITIAL_FIELDS_VALUE,
  FORM_ITEM_LIST,
  TABLE_COLUMNS
}
